<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // var body = document.querySelector('body')
    // console.log(body)
    document.onclick = function (e) {
      var divs = document.createElement('div')
      var x = e.pageX
      var y = e.pageY
      divs.style.width = '50px'
      divs.style.height = '50px'
      divs.style.backgroundColor = 'red'
      divs.style.position = 'absolute'
      divs.style.left = x - 10 + 'px'
      divs.style.top = y - 10 + 'px'
      document.body.appendChild(divs)
    }

  </script>
</body>

</html>